//
//  NYHtmlHelper.h
//  NiuWaJiaoYu
//
//  Created by MinLison on 2018/1/4.
//  Copyright © 2018年 niuwaketang. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <DTCoreText/DTCoreText.h>

typedef void (^NYHtmlHelperImgSizeChangeBlock)(CGSize imgSize);
/**
 要把 DTCoreText 的 delegate 设置为 NYHtmlHelperManager
 */
@interface NYHtmlHelper : NSObject <DTAttributedTextContentViewDelegate, DTLazyImageViewDelegate>

@property(nonatomic, copy) NYHtmlHelperImgSizeChangeBlock imgSizeChangeBlock;
- (NSString *)getImgSizeAndReplaceHtmlString:(NSString *)htmlString;
/**
 从 html 里面获取属性字符串

 @param htmlString  html 字符串
 @param maxImageSize  html 里面图片最大尺寸
 @return 属性字符串
 */
- (NSAttributedString *)attributedStringForHtmlString:(NSString *)htmlString maxImageSize:(CGSize)maxImageSize;
- (NSAttributedString *)attributedStringForHtmlString:(NSString *)htmlString maxImageSize:(CGSize)maxImageSize imgSizeCallBackBlock:(NYHtmlHelperImgSizeChangeBlock)imgSizeCallBack;

/**
 创建html 属性字符串显示 label

 @return DTAttributedLabel
 */
- (DTAttributedLabel *)createAttributedLabel;

/**
 创建html 属性字符串显示 ContentView
 
 @return DTAttributedTextContentView
 */
- (DTAttributedTextContentView *)createAttributedContentView;

/**
 创建html 属性字符串显示 TextView
 
 @return DTAttributedTextView
 */
- (DTAttributedTextView *)createAttributedTextView;
@end
